package com.yuyue.dronesystem.beans;

import java.util.Objects;

/**
 * SpatialPosition
 */
public class SpatialPosition extends Coordinate  {

    // 偏北角
    private Double heading = 0.0;
    // 倾斜角
    private Double pitch = 0.0;
    // 滚转角
    private Double bank = 0.0;


    public SpatialPosition() {
    }

    public SpatialPosition(Double heading, Double pitch, Double bank) {
        this.heading = heading;
        this.pitch = pitch;
        this.bank = bank;
    }

    public SpatialPosition(Double longitude, Double latitude, Double altitude, Double heading, Double pitch, Double bank) {
        super(longitude, latitude, altitude);
        this.heading = heading;
        this.pitch = pitch;
        this.bank = bank;
    }

    public Double getHeading() {
        return this.heading;
    }

    public void setHeading(Double heading) {
        this.heading = heading;
    }

    public Double getPitch() {
        return this.pitch;
    }

    public void setPitch(Double pitch) {
        this.pitch = pitch;
    }

    public Double getRoll() {
        return this.bank;
    }

    public void setRoll(Double bank) {
        this.bank = bank;
    }

    public SpatialPosition heading(Double heading) {
        this.heading = heading;
        return this;
    }

    public SpatialPosition pitch(Double pitch) {
        this.pitch = pitch;
        return this;
    }

    public SpatialPosition bank(Double bank) {
        this.bank = bank;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this)
            return true;
        if (!(o instanceof SpatialPosition)) {
            return false;
        }
        SpatialPosition spatialPosition = (SpatialPosition) o;
        return super.equals((Coordinate) o) && Objects.equals(heading, spatialPosition.heading) && Objects.equals(pitch, spatialPosition.pitch) && Objects.equals(bank, spatialPosition.bank);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), heading, pitch, bank);
    }

    @Override
    public String toString() {
        return "{" +
            " coor='" + super.toString() + "'" +
            ", heading='" + getHeading() + "'" +
            ", pitch='" + getPitch() + "'" +
            ", bank='" + getRoll() + "'" +
            "}";
    }
}